package cn.sinata.wanglin.adapter;

import android.text.TextUtils;
import android.widget.TextView;

import com.xilada.xldutils.adapter.HFRecyclerAdapter;
import com.xilada.xldutils.adapter.util.ViewHolder;
import java.util.List;
import cn.sinata.wanglin.R;
import cn.sinata.wanglin.model.MyLeadMaterial;
import cn.sinata.wanglin.utils.RelativeDateFormat;

public class MyLeadMaterialAdapter extends HFRecyclerAdapter<MyLeadMaterial> {
    public MyLeadMaterialAdapter(List<MyLeadMaterial> mData) {
        super(mData, R.layout.item_myleadmaterial);
    }
    @Override
    public void onBind(int position, MyLeadMaterial data, ViewHolder holder) {
        holder.setText(R.id.tv_time,"存放时间："+ RelativeDateFormat.getTimeYMDHMS(data.getCreateDate()));
        holder.setText(R.id.tv_villagename,"存放小区："+data.getHousingName());
        if(!TextUtils.isEmpty(data.getGoods())){
            holder.setText(R.id.tv_info,"物品信息："+data.getGoods());
        }else{
            holder.setText(R.id.tv_info,"物品信息：暂无");
        }

        if("1".equals(data.getStatus())){
            holder.setText(R.id.tv_isout,"已领取");
            ((TextView) holder.bind(R.id.tv_isout)).setTextColor(mContext.getResources().getColor(R.color.textColor99));
        }else{
            holder.setText(R.id.tv_isout,"未领取");
            ((TextView) holder.bind(R.id.tv_isout)).setTextColor(mContext.getResources().getColor(R.color.app_theme_color));
        }
    }
}
